/**
 * 系统设置权限设置添加管理员
 */
import './index.less'
import tem from './index.html'
import $_fn from '~plugins'
class forbiddenadminCtrl {
  constructor($scope,$rootScope,$ui,http) {
      $scope.cancel = function () {
          $rootScope.$uiDirectiveModal.close() //关闭方法
      }
      $scope.AdminsEnable={
      	ids:$scope.id,
      	locked:0,
      	reason:''
      }
      //禁用管理员提交
      $scope.tiJiao1=function(){
	      	if(!$scope.AdminsEnable.reason || $scope.AdminsEnable.reason.length<1){
      			$ui.toast({
					text:'请填写备注',
					type:'warning',
					appendTo:'.AdminsEnable'
				})
      			return
      		}
	      	http.post('updateAdminsEnable.do',$scope.AdminsEnable,function (data) {
				if(data.errcode==1){
					window.history.go(0)
				}else{
					$ui.toast({
						text:data.errmsg,
						type:'warning',
						appendTo:'.AdminsEnable'
					})
				}
	        },function(_data){
	            console.log(_data);//报错
	        })
      } 
  }
}
forbiddenadminCtrl.$inject = ['$scope','$rootScope','$ui','http']
module.exports = angular.module('directive.forbiddenadmin', []).directive('forbiddenadmin', function() {
    return {
        template: tem,
        replace:true,
        controller: forbiddenadminCtrl,
        scope:{
        	name:'@',
        	id:"@"
        }
    }
}).name